package com.hccl.mongoEntities;

import DM.StateMachine;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.hccl.mongoEntities.action.Action;
import entities.action.BackToMainMenu;
import com.hccl.mongoEntities.step.Step;
import exception.BackToMainMenuException;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import entities.Process;

/**
 * 配置文件中process属性对应的实体对象
 */
@Entity(value = "process", noClassnameStored = true)
public class ProcessEntity {

    @Id
    @JsonIgnore
    ObjectId id;
    String name;
    List<Action> onEnterAction;
    String init_step;
    List<Step> steps = new ArrayList<>();
//    @JsonIgnore
//    Map<String,  Step> stepMap = new HashMap<>();


    public ProcessEntity(){}

    public ProcessEntity(@JsonProperty("name") String name,
                      @JsonProperty("init_step") String init_step,
                   @JsonProperty("steps") List<Step> steps) {
        this.name = name != null ? name : "";
        this.init_step = init_step != null ? init_step : "";
        this.steps = steps;
    }


    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public List<Action> getOnEnterAction() {
        return onEnterAction;
    }

    public void setOnEnterAction(List<Action> onEnterAction) {
        this.onEnterAction = onEnterAction;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getInit_step() {
        return init_step;
    }

    public void setInit_step(String init_step) {
        this.init_step = init_step;
    }

    public List<Step> getSteps() {
        return steps;
    }

    public void setSteps(List<Step> steps) {
        this.steps = steps;
    }



}
